package com.ccys.cms.controller.masterData;

import com.ccys.cms.service.masterData.UnitOfMeasurementService;
import com.ccys.common.constants.TouristApi;
import com.ccys.common.vo.ResponseResult;
import com.ccys.db.dto.masterData.UnitOfMeasurementDelDto;
import com.ccys.db.dto.masterData.UnitOfMeasurementPageQueryDto;
import com.ccys.db.dto.masterData.UnitOfMeasurementSaveDto;
import com.ccys.db.vo.masterData.UnitOfMeasurementPageQueryVo;
import com.ccys.db.vo.web.productAndService.IdNameVo;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: WhiteCoat
 * @description: 计量管理接口
 * @author: ZhangJingCan
 * @create: 2023-12-12 16:21
 **/

@RestController
@RequestMapping("masterData")
@Api(tags = "masterData-计量管理接口")
public class UnitOfMeasurementController {

    @Autowired
    private UnitOfMeasurementService unitOfMeasurementService;



    @PostMapping("unitOfMeasurement")
    @ApiOperation("保存计量管理")
    public ResponseResult save(UnitOfMeasurementSaveDto dto) {
        return unitOfMeasurementService.save(dto);
    }

    @PutMapping("unitOfMeasurement")
    @ApiOperation("保存计量管理")
    public ResponseResult edit(UnitOfMeasurementSaveDto dto) {
        return unitOfMeasurementService.save(dto);
    }


    @DeleteMapping("unitOfMeasurement")
    @ApiOperation("根据ID删除计量管理")
    public ResponseResult delete(UnitOfMeasurementDelDto dto) {
        return unitOfMeasurementService.delete(dto);
    }


    @GetMapping("unitOfMeasurement")
    @ApiOperation("分页查询计量管理")
    public ResponseResult<PageInfo<UnitOfMeasurementPageQueryVo>, Object> findPage(UnitOfMeasurementPageQueryDto dto) {
        return unitOfMeasurementService.findPage(dto);
    }


    @GetMapping("unitOfMeasurement/list")
    @ApiOperation("查询计量管理集合")
    public ResponseResult getList(){

        return unitOfMeasurementService.getIdNameList();
    }

}
